<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Payments_Model extends CI_Model{
	protected $_name = "payments";
	protected $_primary = "PayId";
	var $Payer = "Payer", $Date = "Date", $Transaction = "Transaction", $Money = "Money";
	
	function insertPayment(){
		date_default_timezone_set('Asia/Ho_Chi_Minh');
		$date = date('Y-m-d h:iA',strtotime($_POST['payment_date']));
		$this->db->set($this->Payer, $_POST['business']);
		$this->db->set($this->Date, $date);
		$this->db->set($this->Transaction, $_POST['invoice']);
		$this->db->set($this->Money,$_POST['payment_gross']*20000 );
		
		$this->db->insert($this->_name);
		$id = $this->db->insert_id();
		return $id;
	}
	
}